import { faker } from '@faker-js/faker';

export type User = {
  userId: string;
  username: string;
  email: string;
  avatar: string;
  password: string;
  birthdate?: Date;
  registeredAt?: Date;
  tags?: string[];
  age?: number;
};

export function createRandomUser(): User {
  return {
    userId: faker.string.uuid(),
    username: faker.internet.userName(),
    age: faker.number.int({ min: 15, max: 70 }),
    email: faker.internet.email(),
    avatar: faker.image.avatar(),
    password: faker.internet.password(),
    birthdate: faker.date.birthdate(),
    registeredAt: faker.date.past(),
    tags: faker.helpers.multiple(() => faker.lorem.words({ min: 1, max: 3 }), {
      count: 5,
    }),
  };
}

export function mockList(): User[] {
  const users = faker.helpers.multiple(createRandomUser, {
    count: 30,
  });

  return users;
}
